<?php
$user="root";
		$password="";
		$database="whitehouse";
		mysql_connect(localhost,$user,$password);
		@mysql_select_db($database) or die( "Unable to select database");

//$month = 3;
//$year = 2010;
$month = $_GET['month'];
$year = $_GET['year'];
$days=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$query = "select * from payment where date_received between '$year-$month-01' and '$year-$month-$days' order by date_received";
$result = mysql_query($query) or die(mysql_error());
	$amount=0;
?>
	<table class="tablesorter" id="reportstable">
	<thead>
		<tr>
			<th>Date</th>
			<th>Unit</th>
			<th>Mode</th>
			<th>Amount</th>
		</tr>
	</thead>
	<tbody>
<?php
	$total=0;
while($row = mysql_fetch_array($result)){
	$amount =$row['amount'];
	$total+=$amount;
	$unit =$row['unit'];
	$date =$row['date_received'];
	$mode =$row['mode'];
	?>
	<tr>
	<td><?php echo $date;?></td>
	<td><?php echo $unit;?></td>
	<td><?php echo $mode;?></td>
	<td class="amount"><?php echo $amount;?></td>
	</tr>
	<?php
}
?>
	</tbody>
	<tr>
		<td colspan="3">Total Payments</td>
		<td class="amount"><?php echo $total?></td>
	</tr>
	<table>